package kr.ac.ml.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ac.kr.ml.dao.ListDao;
import ac.kr.ml.vo.ContentVo;
import kr.ac.ml.mvc.Action;

public class ConfirmAction extends Action {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response)
			throws IOException, ServletException {
		// TODO Auto-generated method stub
		Action action = null;
		System.out.println("ConfirmAction");
		String hp = request.getParameter("num");
		String deptlist = request.getParameter("order");
		ListDao dao = new ListDao();
		boolean check = dao.confirm(hp);

		if (check == true) {
			System.out.println("인증성공");
		
			// deptlistaction 호출//
			if (deptlist!=null&&deptlist.equals("deptList")) {
				action = new DeptListAction();
				action.execute(request, response);
				//친구목록생성
			} else if (deptlist!=null&&deptlist.equals("makefriend")) {
				action = new MakeFriendTable();
				action.execute(request, response);
			}
			else if(hp!=null&&check==true) {
				action  = new JSonAction();
				action.execute(request,response);
			}
			else
			{
				action = new ErrorAction();
				action.execute(request, response);
			}
		} else {
			action = new ErrorAction();
			action.execute(request, response);
		}
	}

}
